import request from '@/http/request'

export const getArticle = params => {
  return request({
    url: '/articles',
    method: 'GET',
    params
  })
}

export const deleteArticle = target => {
  return request({
    url: '/articles',
    params: {
      target
    },
    method: 'DELETE'
  })
}

export const publishArticle = (data, draft = false) => { // 设置draft默认值
  return request({
    url: '/articles',
    method: 'POST',
    params: {
      draft
    },
    data
  })
}

export const updataArticle = (target, data, draft = false) => {
  return request({
    url: '/articles',
    method: 'PUT',
    params: {
      draft,
      target
    },
    data
  })
}

export const getAppointArticle = params => {
  return request({
    url: '/articles/appoint',
    method: 'GET',
    params
  })
}
